package com.axjy.web;

import com.axjy.pojo.House;
import com.axjy.pojo.User;
import com.axjy.service.HouseService;
import com.axjy.vo.PageVo;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/house")
public class HouseController {

    @Resource
    private HouseService houseService;

    @GetMapping("/guanli")
    public String guanli(@RequestParam(value = "pager.offset",defaultValue = "0") Integer offset,@RequestParam(defaultValue = "5") Integer pageSize, HttpSession session, Model model){
        User loginUser= (User) session.getAttribute("loginUser");
        PageVo vo=houseService.searchHouse(offset,pageSize,loginUser.getId());
        model.addAttribute("pager",vo);
        return "vip/guanli";
    }


}
